package net.lb.io.json.serializer;

import java.lang.reflect.Type;
import net.lb.baseutil.collection.ObjectCollect;
import net.lb.baseutil.collection.StringCache;
import net.lb.io.json.field.JsonField;
import net.lb.io.json.util.JsonSerializer;

public class FloatSerializer implements JsonSerializer
{
    
    @Override
    public Object transToJsonvalue(Object src, ObjectCollect collect)
    {
        return src;
    }
    
    @Override
    public void setJsonFields(JsonField[] jsonFields)
    {
        // TODO Auto-generated method stub
        
    }
    
    @Override
    public void writeToString(StringCache cache, Object value, ObjectCollect collect)
    {
        // 不需要判断值是否为空，如果是在一个对象里的属性，则值是否为空由jsonfield负责
        cache.append(((Float) value).floatValue());
    }
    
    @Override
    public Object toBean(Object value, Type type)
    {
        return value;
    }
    
}
